package schema

import (
	"entgo.io/ent"
	"entgo.io/ent/schema/edge"
	"entgo.io/ent/schema/field"
)

// AlarmLog holds the schema definition for the AlarmLog entity.
type AlarmLog struct {
	ent.Schema
}

// Fields of the AlarmLog.
func (AlarmLog) Fields() []ent.Field {
	return []ent.Field{
		field.Time("alarm_at").Comment("告警时间"),
		field.Int("record_level").Comment("本次记录的最高告警等级"),
		field.Int("metric_level").Comment("本次告警记录对应指标的告警等级"),
		field.String("detail").Comment("对应指标的告警详情"),
	}
}

// Edges of the AlarmLog.
func (AlarmLog) Edges() []ent.Edge {
	return []ent.Edge{
		edge.To("sent_for_object", Object.Type).Unique().Required(),
		edge.To("sent_for_metric", Metric.Type).Unique().Required(),
	}
}
